$(document).ready(function(){

    if(window.name != "nocache"){
        location.reload();
        window.name = "nocache";
    }else{
        window.name = "";
    }

    $("#btn").click(function () {
        $(this).attr("disabled",true);
        var username =  $("#username").val();
        var password =  $("#password").val();
        var param = {};
        param['username'] = username;
        param["password"] = password;
        $.ajax({
            type:"post",
            url:"./dologin.do",
            data:param,
            dataType:"json",
            success:function(data){
                if(data == "success"){
                    window.location.href = "./index.do?r="+Math.random();
                }else {
                    $("#btn").removeAttr("disabled");
                    alert(data);
                }
            }
        });
    });
});